************************************************
***Title: time_series_pollen_suicide.do
***Creators: Joelle Abramowitz, Shooshan Danagoulian, and Owen Fleming*
***Notes: This creates a time series visualization of pollen and suicide averages.

*For questions, contact
*Owen Fleming
*hg3490@wayne.edu
************************************************


**********SETUP
use data/for_analysis, clear


**********PRODUCE VISUALIZATION
keep if year>=2006
keep if year <= 2016

gen ym = ym(year, month)

collapse (mean) pollen (sum) count, by(ym)

label variable pollen "Monthly Average of Pollen (pcm)"
label variable count "Monthly Count of Suicides"

tsset ym, monthly

twoway tsline count, yaxis(2) lpattern(dash) || tsline pollen, yaxis(1) lpattern(solid) tlabel(2006m1 "2006" 2007m1 " " 2008m1 "2008" 2009m1 " " 2010m1 "2010" 2011m1 " " 2012m1 "2012" 2013m1 " " 2014m1 "2014" 2015m1 " " 2016m1 "2016" 2017m1 " ") xtitle(" ") ysize(5) xsize(10) graphregion(color(white)) leg(pos(6))


**********EXPORT
graph export results/time_series_pollen_suicide.png, replace

